package cn.sz.dzy.io.chat;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

/**
 * @program: io
 * @description:
 * @author: DingZhenYun
 * @create: 2024-05-24 11:22
 **/

public class ClientReaderThread extends Thread {
    private Socket socket;

    public ClientReaderThread(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            String msg="";
            while ((msg = br.readLine())!=null){
                System.out.println("收到服务器转发的数据:"+msg);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
